package ysq.xyg.web.model.po;

import lombok.NoArgsConstructor;

import lombok.Data;
import ysq.xyg.base.util.BaseConstant;
import ysq.xyg.base.util.BaseUtil;
import ysq.xyg.sys.model.po.SysUser;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * 业务模块-微信账号实体类
 *
 * @author shengQiang yu
 * @date 2019-4-26 11:34:01
 */
@Data
@NoArgsConstructor
@Table(name = "xyg_web_account")
public class WebAccount implements Serializable{

	/**
     * 主键
     */ 
	@Id
	private String id;
	
	/**
     * 名称
     */ 
	@Column(name = "name")
	private String name;
	
	/**
     * 公众号token
     */ 
	@Column(name = "token")
	private String token;
	
	/**
     * 公众号连接
     */ 
	@Column(name = "url")
	private String url;
	
	/**
     * 公众号appid
     */ 
	@Column(name = "app_id")
	private String appId;
	
	/**
     * 公众号secret
     */ 
	@Column(name = "app_secret")
	private String appSecret;
	
	/**
     * 公众号accessToken
     */ 
	@Column(name = "access_token")
	private String accessToken;
	
	/**
     * 公众号accessToken有效时间
     */ 
	@Column(name = "access_token_end_time")
	private Date accessTokenEndTime;
	
	/**
     * 公众号有效时间长度
     */ 
	@Column(name = "expiresIn")
	private int expiresIn;
	
	/**
     * 微信公众号js的ticket
     */ 
	@Column(name = "js_ticket")
	private String jsTicket;
	
	/**
     * 微信公众号js的ticket有效截止时间
     */ 
	@Column(name = "js_ticket_end_time")
	private Date jsTicketEndTime;
	
	/**
     * 支付秘钥
     */ 
	@Column(name = "pay_key")
	private String payKey;
	
	/**
     * 商户号
     */ 
	@Column(name = "pay_mch_id")
	private String payMchId;
	
	/**
     * 小程序appId
     */ 
	@Column(name = "xcx_app_id")
	private String xcxAppId;
	
	/**
     * 小程序appSecret
     */ 
	@Column(name = "xcx_app_secret")
	private String xcxAppSecret;
	
	/**
     * 小程序accessToken
     */ 
	@Column(name = "xcx_access_token")
	private String xcxAccessToken;
	
	/**
     * 小程序accessToken有效截止时间
     */ 
	@Column(name = "xcx_access_token_end_time")
	private Date xcxAccessTokenEndTime;

	/**
	 * 项目地址
	 */
	@Column(name = "base_url")
	private String baseUrl;

	/**
	 * 模板id
	 */
	@Column(name = "template_id")
	private String templateId;

	/**
     * 删除标注:1、正常，2、删除
     */ 
	@Column(name = "remove_tag")
	private String removeTag;
	
	/**
     * 创建时间
     */ 
	@Column(name = "create_time")
	private Date createTime;
	
	/**
     * 创建人
     */ 
	@Column(name = "create_user")
	private String createUser;
	
	/**
     * 修改时间
     */ 
	@Column(name = "update_time")
	private Date updateTime;
	
	/**
     * 修改人
     */ 
	@Column(name = "update_user")
	private String updateUser;
	

	public WebAccount(SysUser sysUser) {
		this.id= BaseUtil.uId();
		this.removeTag= BaseConstant.BASE_REMOVE_TAG_NORMAL;
		this.createTime = new Date();
		this.createUser = sysUser.getId();
		this.updateTime = new Date();
		this.updateUser = sysUser.getId();
	}
}